﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace DataSentryPro_R2.Model
{
 

       //This class actually does evaluation on each item template binding returns visible or collapsed
    [ValueConversion(typeof(int), typeof(String))]
    public class intTostrConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int myCounter = (int)value;
            return myCounter.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string strValue = value as string;
            int resultInt;
        
            // Convert the String back to an Integer
            if (int.TryParse(strValue, out resultInt))
            {
                return resultInt;
            }
            return System.Windows.DependencyProperty.UnsetValue;
        }


    }
}



